package com.gmp.product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

import com.gmp.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gmp.product.mapper.WorkDispatchMapper;
import com.gmp.product.domain.WorkDispatch;
import com.gmp.product.service.IWorkDispatchService;

/**
 * 派单Service业务层处理
 *
 * @author Koi
 * @date 2025-10-10
 */
@Service
public class WorkDispatchServiceImpl extends ServiceImpl<WorkDispatchMapper, WorkDispatch> implements IWorkDispatchService {
    @Autowired
    private WorkDispatchMapper workDispatchMapper;

    /**
     * 查询派单
     *
     * @param id 派单主键
     * @return 派单
     */
    @Override
    public WorkDispatch selectWorkDispatchById(String id) {
        return workDispatchMapper.selectWorkDispatchById(id);
    }

    /**
     * 查询派单列表
     *
     * @param workDispatch 派单
     * @return 派单
     */
    @Override
    public List<WorkDispatch> selectWorkDispatchList(WorkDispatch workDispatch) {
        return workDispatchMapper.selectWorkDispatchList(workDispatch);
    }

    /**
     * 新增派单
     *
     * @param workDispatch 派单
     * @return 结果
     */
    @Override
    public int insertWorkDispatch(WorkDispatch workDispatch) {
        workDispatch.setCreateTime(DateUtils.getNowDate());
        return workDispatchMapper.insertWorkDispatch(workDispatch);
    }

    /**
     * 修改派单
     *
     * @param workDispatch 派单
     * @return 结果
     */
    @Override
    public int updateWorkDispatch(WorkDispatch workDispatch) {
        workDispatch.setUpdateTime(DateUtils.getNowDate());
        return workDispatchMapper.updateWorkDispatch(workDispatch);
    }

    /**
     * 批量删除派单
     *
     * @param ids 需要删除的派单主键
     * @return 结果
     */
    @Override
    public int deleteWorkDispatchByIds(String[] ids) {
        return workDispatchMapper.deleteWorkDispatchByIds(ids);
    }

    /**
     * 删除派单信息
     *
     * @param id 派单主键
     * @return 结果
     */
    @Override
    public int deleteWorkDispatchById(String id) {
        return workDispatchMapper.deleteWorkDispatchById(id);
    }
}
